package com.jf.cloud.user.service.impl;

import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.util.PageUtil;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.user.model.UserFans;
import com.jf.cloud.user.mapper.UserFansMapper;
import com.jf.cloud.user.service.UserFansService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * 
 *
 * @author zz
 * @date 2023-12-01 14:30:05
 */
@Service
public class UserFansServiceImpl implements UserFansService {

    @Autowired
    private UserFansMapper userFansMapper;

    @Override
    public PageVO<UserFans> page(PageDTO pageDTO,UserFans userFans) {
        return PageUtil.doPage(pageDTO, () -> userFansMapper.list(userFans));
    }

    @Override
    public UserFans getById(Long id) {
        return userFansMapper.getById(id);
    }

    @Override
    public UserFans getByUserIdAndFansId(Long userId, Long fansId) {
        return userFansMapper.getByUserIdAndFansId(userId,fansId);
    }

    @Override
    public void save(UserFans userFans) {
        userFansMapper.save(userFans);
    }

    @Override
    public int count(Long userId) {
        return userFansMapper.count(userId);
    }

    @Override
    public int mycount(Long userId) {
        return userFansMapper.mycount(userId);
    }

    @Override
    public void update(UserFans userFans) {
        userFansMapper.update(userFans);
    }

    @Override
    public void deleteById(Long id) {
        userFansMapper.deleteById(id);
    }
}
